/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.invoice.busines;

import com.invoice.model.dao.ArticuloDAO;
import com.invoice.model.dao.ArticuloDAOHibernate;
import com.invoice.busines.dto.ArticuloDTO;
import java.io.Serializable;
import java.util.List;

/**
 *
 * @author laura
 */
public class ArticuloBOImpl implements ArticuloBO,Serializable{
    ArticuloDAO articuloDAO = new ArticuloDAOHibernate();
    @Override
    public ArticuloDTO addArticulo(ArticuloDTO articuloDTO) throws Exception {
        Integer id=(Integer)articuloDAO.add(articuloDTO);
        articuloDTO.setIdArticulo(id);
        return articuloDTO;
    }

    @Override
    public void updateArticulo(ArticuloDTO articuloDTO) throws Exception {
        articuloDAO.update(articuloDTO);
    }

    @Override
    public ArticuloDTO findArticulo(String idArticulo) throws Exception {
        return articuloDAO.findByIdArticulo(idArticulo);
    }
    
    @Override
    public List<ArticuloDTO> findByHabilitado() throws Exception {
        return articuloDAO.findByHabilitado();
    }
    @Override
    public List<ArticuloDTO> findAll() throws Exception {
        return articuloDAO.findAll();
    }
    
}
